package com.hyt.it.ogt.kq.service.bm.mq;

import com.hyt.it.ogt.kq.common.config.ConfigManager;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 报名项目数据统计消息生产者
 *
 * @author huangwu
 * @date 2022-09-05
 */
@Component
@Slf4j
public class ProjectStatisticProducer {

    @Resource
    private ConfigManager configManager;
    @Resource
    private RabbitTemplate rabbitTemplate;

    /**
     * 推送消息
     *
     * @param projectId
     */
    public void sendMessage(String projectId) {
        // 推送一个消息
        rabbitTemplate.convertAndSend(configManager.getDirect(), configManager.getProjectStatisticRoute(), projectId);
    }
}
